<?php
my_component_load('testing' , false);
my_component_load('paging' , false);  
my_component_load('seragam_entry' );
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$modulname = "Kesejahteraan _BN_ Seragam Kerja";
 
if($_SERVER['REQUEST_METHOD'] == "POST" ):
	switch($task){
		case   "edit_seragam_page" :
			$validate = valid_seragam($id );
			if($validate){
				$errors = message_multi_error($validate);
				$content = $errors;
				$content .= form_seragam($id);
				generate_my_web($content, $pagename,'plain.php' );
				exit;
			}else{
				submit_seragam($id);
				generate_my_web("Updated", $pagename,'plain.php' );
				exit;
			}			
			break;
	}

else: 	
	if($task == 'list_seragam_karyawan'){
		load_facebox_script();
		$pagename =$modulname." _BN_ Karyawan" ; 
		$view = list_seragam_karyawan($id);
	}elseif($task == "cetak_seragam_karyawan"){
		@ob_end_clean(); 
		echo'<pre>';
		echo cetak_seragam_karyawan($id);
		exit;
	}elseif($task == "excel_seragam_karyawan"){
		header("Content-Type: application/xls");
		header("Content-Disposition: attachment;filename=seragam_karyawan.xls");
		echo excel_seragam_karyawan($id);
		exit;		
	
	}elseif($task == "edit_seragam"){
		$title= ($id ==0) ? "Tambah Data" : "Perubahan Data"  ;
		facebox_page('index.php?com='.$_GET['com'].'&task=edit_seragam_page&id='.$id , $title , 220	); 
	}elseif($task == "edit_seragam_page"){
		$content = form_seragam($id);
		generate_my_web($content, $pagename,'plain.php' );
		exit;	
	}elseif($task == 'delete'){ 
		delete_seragam($id);
		my_direct('index.php?com='.$_GET['com']);
	}else{
		$pagename = $modulname ; 
		load_facebox_script();
		$view =  list_seragam(); 
	}
endif; 
generate_my_web($view, $pagename );
?>